package com.qyh.hhh;

import lombok.RequiredArgsConstructor;
import org.springframework.aop.framework.autoproxy.AbstractBeanFactoryAwareAdvisingPostProcessor;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.ApplicationContext;

@RequiredArgsConstructor
public class ToggleAnnotationBeanPostProcessor extends AbstractBeanFactoryAwareAdvisingPostProcessor {
    private final ApplicationContext applicationContext;

    @Override
    public void setBeanFactory(BeanFactory beanFactory) {
        super.setBeanFactory(beanFactory);
        this.advisor = new TogglePointcutAdvisor(
                new ToggleMethodInterceptor(applicationContext)
        );
    }
}
